import requests
from requests import Request


class BaseRequest:
    def __init__(
        self,
        url: str = None,
        method: str = None,
        headers: dict = None,
        body: str = None,
    ):
        """

        @param url:
        @param method:
        @param headers:
        @param body:
        """
        self.url = url
        self.method = method
        self.headers: dict = headers
        self.body = body

    def get_url(self):
        return self.url

    def get_method(self):
        return self.method

    def get_headers(self):
        return self.headers

    def get_body(self):
        return self.body

    def set_url(self, url):
        self.url = url

    def set_method(self, method):
        self.method = method

    def set_headers(self, headers):
        self.headers = headers

    def set_body(self, body):
        self.body = body


if __name__ == "__main__":
    test = requests.get(
        "http://192.168.120.220/v1.0/api_intelligent_tower_get_roma_notam"
    )

    import json

    content = test.content

    # bytes转str
    content_str = content.decode("UTF-8")
    print(content_str.encode("UTF-8"))
    result = json.loads(content_str)

    for i in result:
        print(i)
